#ifndef GSQUARE_H
#define GSQUARE_H

#include <QWidget>
#include <QPixmap>
#include <QGraphicsProxyWidget>
#include <QGraphicsPixmapItem>
#include <QGraphicsView>
#include <QPushButton>
#include <QButtonGroup>
#include <QLabel>
#include <QMessageBox>
#include <QTimer>

#include "gcase.h"
#include "playermanager.h"
#include "GameException.h"
#include "JudgeDredd.h"


class GSquare : public QWidget
{
    Q_OBJECT
public:
    explicit GSquare(QWidget *parent = 0);
    ~GSquare();

    const void setFond(QPixmap *pixmap);
    const void createMySquare();
    const void createPlayers();


signals:
//    void myClicked(const int coord);
//    void button_pressed(int coord);

public slots:
    void button_pressed(QAbstractButton *sender);
    void button_released(QAbstractButton *sender);
    void end_of_box();

private :
    int nb_col;
    int current_player;
    int ia;

    QGraphicsPixmapItem *fond;
    QGraphicsView *vw_square;
    QGraphicsScene *scene;
    QButtonGroup *group_pions;

    PlayerManager *j1;
    PlayerManager *j2;

    QMessageBox box;

    void check_result(int result);
    void change_currentPlayer();
    void change_btn_state(GCase *tmp_btn);
};

#endif // GSQUARE_H
